package com.truyentranh.modules.local;

import java.util.ArrayList;

import com.truyentranh.R;
import com.truyentranh.data.HaiBLModule;
import com.truyentranh.data.MenuMoreItem;
import com.truyentranh.modules.epicvn.EpicVnActivity;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MoreMenuRenderAdapter extends ArrayAdapter<MenuMoreItem> {

	ArrayList<MenuMoreItem> blockList = null;

	public MoreMenuRenderAdapter(Context context, int resource, int textViewResourceId, ArrayList<MenuMoreItem> objects) {
		super(context, resource, textViewResourceId, objects);
		this.blockList = objects;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub

		LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowHeader = inflater.inflate(R.layout.more_menu_render_modules, parent, false);
		TextView header = (TextView) rowHeader.findViewById(R.id.nameView);		
		ImageView avatar = (ImageView) rowHeader.findViewById(R.id.avatarView);		
		MenuMoreItem module = this.blockList.get(position);
		header.setText(module.getName());
		
		switch (module.getId()) {
//		case MenuMoreItem.UTILS_WEB:
//			avatar.setImageResource(R.drawable.ic_utils);
//			break;
		case MenuMoreItem.VIEW_OFFLINE:
			avatar.setImageResource(R.drawable.ic_saved_comic);
			break;
//		case MenuMoreItem.MORE_EPIC:
//			avatar.setImageResource(R.drawable.ic_more_epic);
//			break;
		case MenuMoreItem.SETTING_APP:
			avatar.setImageResource(R.drawable.ic_setting);
			break;
		case MenuMoreItem.CONTACT_PR:
			avatar.setImageResource(R.drawable.ic_about);
			break;
		}
		return rowHeader;
	}

}
